public class Reactor11TcpClient<P> extends java.lang.Object implements TcpOperations<P>
TcpOperations
based on the TCP client support of the Reactor project.Modifier and Type | Class and Description |
---|---|
private static class |
Reactor11TcpClient.SynchronousDispatcherConfigReader
A ConfigurationReader that enforces the use of a SynchronousDispatcher.
|
Modifier and Type | Field and Description |
---|---|
private Environment |
environment |
static java.lang.Class<NettyTcpClient> |
REACTOR_TCP_CLIENT_TYPE |
private <any> |
tcpClient |
Constructor and Description |
---|
Reactor11TcpClient(<any> tcpClient)
A constructor with a pre-configured
reactor.net.tcp.TcpClient . |
Reactor11TcpClient(java.lang.String host,
int port,
<any> codec)
A constructor that creates a
reactor.net.netty.tcp.NettyTcpClient with
a reactor.event.dispatch.SynchronousDispatcher as a result of which
network I/O is handled in Netty threads. |
Modifier and Type | Method and Description |
---|---|
private void |
composeConnectionHandling(<any> composable,
TcpConnectionHandler<P> connectionHandler) |
ListenableFuture<java.lang.Void> |
connect(TcpConnectionHandler<P> connectionHandler)
Open a new connection.
|
ListenableFuture<java.lang.Void> |
connect(TcpConnectionHandler<P> connectionHandler,
ReconnectStrategy reconnectStrategy)
Open a new connection and a strategy for reconnecting if the connection fails.
|
ListenableFuture<java.lang.Boolean> |
shutdown()
Shut down and close any open connections.
|
public static final java.lang.Class<NettyTcpClient> REACTOR_TCP_CLIENT_TYPE
private final <any> tcpClient
private final Environment environment
public Reactor11TcpClient(java.lang.String host, int port, <any> codec)
reactor.net.netty.tcp.NettyTcpClient
with
a reactor.event.dispatch.SynchronousDispatcher
as a result of which
network I/O is handled in Netty threads.
Also see the constructor accepting a pre-configured Reactor
reactor.net.tcp.TcpClient
.
host
- the host to connect toport
- the port to connect tocodec
- the codec to use for encoding and decoding the TCP streampublic Reactor11TcpClient(<any> tcpClient)
reactor.net.tcp.TcpClient
.
NOTE: if the client is configured with a thread-creating
dispatcher, you are responsible for shutting down the reactor.core.Environment
instance with which the client is configured.
tcpClient
- the TcpClient to usepublic ListenableFuture<java.lang.Void> connect(TcpConnectionHandler<P> connectionHandler)
TcpOperations
connect
in interface TcpOperations<P>
connectionHandler
- a handler to manage the connectionpublic ListenableFuture<java.lang.Void> connect(TcpConnectionHandler<P> connectionHandler, ReconnectStrategy reconnectStrategy)
TcpOperations
connect
in interface TcpOperations<P>
connectionHandler
- a handler to manage the connectionreconnectStrategy
- a strategy for reconnectingprivate void composeConnectionHandling(<any> composable, TcpConnectionHandler<P> connectionHandler)
public ListenableFuture<java.lang.Boolean> shutdown()
TcpOperations
shutdown
in interface TcpOperations<P>